#include "dlg_ueradd.h"
#include "ui_dlg_ueradd.h"
#include "lib/sql.h"
dlg_ueradd::dlg_ueradd(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::dlg_ueradd)
{
    ui->setupUi(this);
}

dlg_ueradd::~dlg_ueradd()
{
    delete ui;
}

void dlg_ueradd::types(int user_id)
{
    id=user_id;
}

void dlg_ueradd::on_pushButton_clicked()
{
    //确定
    QStringList l;
    l<<QString::number(id);

    l<<ui->lineEdit_2->text();
    l<<ui->lineEdit_3->text();
    l<<ui->lineEdit_4->text();
    l<<ui->lineEdit_5->text();
    l<<ui->lineEdit_6->text();
    if(id == -1){
        //增加
        Sql::getinstance()->adduser(l);

    }else{
        //更新
        Sql::getinstance()->changeuser(l);
    }
    this->hide();
}


void dlg_ueradd::on_pushButton_2_clicked()
{
    //取消
      this->hide();
}

